package com.wsz.eduservice.controller.front;

import com.wsz.commonutils.R;
import com.wsz.eduservice.pojo.Course;
import com.wsz.eduservice.pojo.Teacher;
import com.wsz.eduservice.service.CourseService;
import com.wsz.eduservice.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/eduservice/indexfront")
public class IndexFrontController {

    @Autowired
    private TeacherService teacherService;

    @Autowired
    private CourseService courseService;

    @GetMapping("/index")
    public R index() {
        List<Course> list = courseService.getCourseIndex();

        List<Teacher> list1 = teacherService.getTeacherIndex();

        return R.ok().data("eduList",list).data("teacherList",list1);
    }

}
